

/*! \file ntfs_index_buffer.h
 *  \brief 
 */

#ifndef __NTFS__INDEX__BUFFER__
#define __NTFS__INDEX__BUFFER__

bool 
ntfs_index_buffer_find_entry(     
                                 IN  PINDEX_ALLOCATION_BUFFER     p_buffer,          \
                                 IN  PNTFS_CONTEXT                p_context,         \
                                 IN  PINDEX_ENTRY                 p_search_entry,    \
                                 IN  bool                         b_is_skip,         \
                                 OUT PINDEX_ENTRY*                p_found            \
                           );

bool 
ntfs_index_buffer_insert_entry( 
                                   IN PINDEX_ALLOCATION_BUFFER     p_buffer,            \
                                   IN PNTFS_CONTEXT                p_context,           \
                                   IN PINDEX_ENTRY                 p_new_entry,         \
                                   IN PINDEX_ENTRY                 p_insert_point       \
                             );

void
ntfs_index_buffer_remove_entry( 
                                   IN PINDEX_ALLOCATION_BUFFER     p_buffer,      \
                                   IN PINDEX_ENTRY p_entry_remove                 \
                             );

PINDEX_ENTRY
ntfs_index_buffer_find_split_point( 
                                    IN PINDEX_ALLOCATION_BUFFER p_buffer
                                   );
void
ntfs_index_buffer_insert_clump( 
                                   IN PINDEX_ALLOCATION_BUFFER p_buffer,    \
                                   IN ULONG u_clump_len,                    \
                                   IN PVOID p_clump                         \
                               );

void
ntfs_index_buffer_remove_clump( 
                                    IN PINDEX_ALLOCATION_BUFFER p_buffer,    \
                                    IN ULONG u_clump_len                     \
                               );

bool 
ntfs_index_buffer_is_empty( IN PINDEX_ALLOCATION_BUFFER p_buffer );

bool ntfs_index_buffer_read_from_attri_alloc( 
                            IN  PNTFS_CONTEXT   p_context,              \
                            IN  PATTRIBUTE_RECORD_HEADER p_alloc,       \
                            IN  VCN   buffer_vcn,                       \
                            OUT PINDEX_ALLOCATION_BUFFER  p_buffer      \
                        );

bool ntfs_index_buffer_is_leaf( 
                                    IN PINDEX_ALLOCATION_BUFFER p_buffer
                               );

bool ntfs_index_buffer_init(    
                                IN PINDEX_ALLOCATION_BUFFER p_buffer,  \
                                IN PNTFS_CONTEXT p_context,            \
                                IN VCN  buffer_vcn,                    \
                                IN bool is_leaf,                       \
                                IN VCN  end_entry_child                \
                            );

#endif